package com.woniuxy.hrp.utils;

import com.woniuxy.hrp.entity.Walletopr;

import java.util.ArrayList;
import java.util.List;

/**
 * @program: hrph
 * @ClassName QueryByPage 查询相关
 * @description:
 * @author: LRW
 * @create: 2022-09-07 18:31
 * @Version 1.0
 **/
public class QueryUtil {

    /***
     * @description: 对List集合分页
     * @param: dataList 数据集合;pagesize页面大小;currentPage 当前页面
     * @return: java.util.List<java.lang.String>
     * @author Lrw
     * @date: 2022/9/7 1:36
     */
    public static List getByPage(List dataList, int pageSize, int currentPage) {
        List currentPageList = new ArrayList<>();
        if (dataList != null && dataList.size() > 0) {
            int currIdx = (currentPage > 1 ? (currentPage - 1) * pageSize : 0);
            for (int i = 0; i < pageSize && i < dataList.size() - currIdx; i++) {
                Object data = dataList.get(currIdx + i);
                currentPageList.add(data);
            }
        }
        return currentPageList;
    }

}
